import request from '@/utils/request'
import {useTokenStore} from '@/stores/token.js'
// 获取文章分类
export const artGetChannelsService = ()=>{
    //先获取token
    let token = useTokenStore().token
    console.log(token)
    //pinia中定义的响应式对象都不需要.value
    return request.get('/category/list')
}
// 添加文章分类
export const artAddChannelsService = (param)=>{
    return request.post('/category/add', param)
}

// 编辑文章分类
export const artUpdateChannelsService = (param)=>{
    return request.post('/category/update', param)
}

// 删除文章分类
export const artDeleteChannelsService = (id)=>{
    return request.delete('/category/delete?id='+id)
}

//文章列表查询
export const artListChannelsService = (params)=>{
    return request.get('/article/list', {params:params})
}

//添加文章
export const addArticleService = (param)=>{
    return request.post('/article/add', param)
}

//更新文章
export const updateArticleService = (param)=>{
    return request.post("/article/update", param)
}

//删除文章
export const deleteArticleService = (id)=>{
    return request.post("/article/delete?id="+id)
}

//导出文章数据
 export const exportArticleService = ()=>{
    return request.get("/exportExcel")
 }
